package com.example.modulethree.adapter.binder

import android.text.TextUtils

import com.example.modulethree.adapter.delegate.KotlinTestAdapterDelegate
import com.example.mvp.binder.BaseDataBinder

/**
 * 数据视图绑定（数据驱动视图有延迟刷新）
 * Created by sun.li on 2018/6/28.
 *
 * @author sun.li
 */

class KotlinTestAdapterBinder : BaseDataBinder<KotlinTestAdapterDelegate, String> {

    override fun viewBindModel(viewDelegate: KotlinTestAdapterDelegate?, data: String?) {
        if (null == data || null == viewDelegate) {
            return
        }
        //        if(!TextUtils.isEmpty(data)){
        //            viewDelegate.setText(data);
        //        }
        strBindView(viewDelegate, data)
    }

    override fun getDataClass(): Class<String> {
        return String::class.java
    }

    /**
     * 数据对象1业务处理
     */
    private fun strBindView(viewDelegate: KotlinTestAdapterDelegate, str: String) {
        if (!TextUtils.isEmpty(str)) {
            viewDelegate.setText(str)
        }
    }


}
